package Loganseabolt.weapons;

import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;

public class Furys_Gun extends Item {

	public Furys_Gun(int par1) {
		super(par1);
		this.setCreativeTab(CreativeTabs.tabCombat);
		// TODO Auto-generated constructor stub
	}
	
	
	 public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
	 {
		 MovingObjectPosition Coord = par3EntityPlayer.rayTrace(50, 1);
		 float explosionsize = 1;
		if(Coord != null)
		 {
				Vec3 playerPos = Vec3.createVectorHelper(par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ);
				Vec3 target = Vec3.createVectorHelper(Coord.blockX, Coord.blockY, Coord.blockZ);
				float dist = (float)target.distanceTo(playerPos);
			     if(dist > 15)
				 explosionsize = 5;
			 par2World.createExplosion(par3EntityPlayer,  Coord.blockX,  Coord.blockY,  Coord.blockZ, explosionsize, true);
		 
		 }
		 return par1ItemStack; 
	 }
	
	
	public void registerIcons(IconRegister iconReg){
		itemIcon = iconReg.registerIcon("LoganSeaboltModBase:FuryG");
	}
	
	

}
